<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>主界面</title>
    <link rel="stylesheet" href="plugins/layui/css/layui.css">
    <style>
        .icon {
            background-image: url('../../image/user.jpg');
            background-repeat: no-repeat;
            background-size: 25px;
            background-position: left center;
        }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo icon" id="userInfo"></div>
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item">
                <a href="javascript:;">系统设置</a>
                <dl class="layui-nav-child">
                    <dd><a href="/sys/logout">退出</a></dd>
                </dl>
            </li>
        </ul>
        <!--<ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="">控制台</a></li>
            <li class="layui-nav-item"><a href="">商品管理</a></li>
            <li class="layui-nav-item"><a href="">用户</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">其它系统</a>
                <dl class="layui-nav-child">
                    <dd><a href="">邮件管理</a></dd>
                    <dd><a href="">消息管理</a></dd>
                    <dd><a href="">授权管理</a></dd>
                </dl>
            </li>
        </ul>-->
       <!--<ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                    贤心
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                    <dd><a href="">安全设置</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="">退了</a></li>
        </ul>-->
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item layui-this"><a onclick="iframeForward('./console/console.html');" href="javascript:void(0);">控制台</a></li>
                <li class="layui-nav-item"><a onclick="iframeForward('./leave/leaveList.html');" href="javascript:void(0);">请假流程</a></li>
                <li class="layui-nav-item"><a onclick="iframeForward('./leave/leaveApply.html');" href="javascript:void(0);">请假申请</a></li>
                <!--<li class="layui-nav-item"><a onclick="iframeForward('./config/config.html');" href="javascript:void(0);">配置文件管理</a></li>-->
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">
            <iframe src="./console/console.html" frameborder="0" width="100%;" height="830px" scrolling="no" id="myFrame"></iframe>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © com.lgy - 版权所有
    </div>
</div>
<script src="plugins/layui/layui.js"></script>
<script src="libs/jquery.min.js"></script>
<script>
    $(function() {
        //初始化iframe高度
        //setIframeHeight($("#myFrame")[0]);
        $.ajax({
            url:'/sys/getLoginInfo',
            dataType:'json',
            dataType:'text',
            success:function (data) {
                data = eval('(' + data + ')');
                if (data.code == '200'){
                    console.log(data);
                    $("#userInfo").text("你好：" + data.message);
                }
            }
        })
    })

    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element;
        console.log(element);
    })

    /*function setIframeHeight(iframe) {
        if (iframe) {
            var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
            if (iframeWin.document.body) {
                iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
            }
        }
    }*/

    function iframeForward(url) {
        $("#myFrame")[0].src = url;
    }

    //获取url中的参数
    /*function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg); //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
    }*/
</script>
</body>
</html>